import request from '@/config/axios'

export interface shortLinkGenerateeVO {
  id: number
  name: string
  status: number
  createTime: Date
  domain: string
  type: number
}

export interface UpdateStatusReqVO {
  id: number
  status: number
}

// 创建客服链接配置
export const createShortLinkGeneratee = async (data) => {
  return await request.post({
    url: '/promotion/short-link-generatee/create',
    data: data
  })
}

// 更新客服链接配置
export const updateShortLinkGeneratee = async (data) => {
  return await request.put({
    url: '/promotion/short-link-generatee/update',
    data: data
  })
}

// 删除客服链接配置
export const deleteShortLinkGeneratee = async (id) => {
  return request.get({
    url: '/promotion/short-link-generatee/delete?id=' + id,
    method: 'delete'
  })
}

// 获得客服链接配置
export const getShortLinkGeneratee = async (id) => {
  return request.get({
    url: '/promotion/short-link-generatee/get?id=' + id,
    method: 'get'
  })
}

// 获得客服链接配置分页
export const getShortLinkGenerateePage = async (query) => {
  return request.get({
    url: '/promotion/short-link-generatee/page',
    method: 'get',
    params: query
  })
}

// 导出客服链接配置 Excel
export const exportShortLinkGenerateeExcel = async (query) => {
  return request.get({
    url: '/promotion/short-link-generatee/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 关闭客服链接
export const closeShortLinkGeneratee = async (id: number) => {
  return await request.put({ url: '/promotion/short-link-generatee/close?id=' + id })
}

// 根据条件查询列表
export const domainList = async (type: number) => {
  return request.get({
    url: '/promotion/domain-manage/domainList?type=' + type,
    method: 'get'
  })
}

// 下载短链接导入模板
export const importShortLinkTemplate = () => {
  return request.download({ url: '/promotion/short-link-detail/get-import-template' })
}
